﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework;

namespace Blockey.GameObjects3D
{
    public class ControllingPlayer
    {

        public ControllingPlayer()
        {
            m_oLocalGamer = null;
            m_oRemoteGamer = null;
        }

        public ControllingPlayer(PlayerIndex oIndex)
        {
            m_oLocalGamer = oIndex;
            m_oRemoteGamer = null;
        }

        public ControllingPlayer(NetworkGamer oRemoteGamer)
        {
            m_oLocalGamer = null;
            m_oRemoteGamer = oRemoteGamer;
        }

        public PlayerIndex? LocalPlayer
        {
            get { return m_oLocalGamer; }
            set
            {
                m_oLocalGamer = value;
                m_oRemoteGamer = null;
            }
        }

        public NetworkGamer RemoteGamer
        {
            get { return m_oRemoteGamer; }
            set
            {
                m_oRemoteGamer = value;
                m_oLocalGamer = null;
            }
        }

        public bool IsAI
        {
            get { return RemoteGamer == null && LocalPlayer == null; }
        }

        public static ControllingPlayer PlayerOne
        {
            get { return new ControllingPlayer(PlayerIndex.One); }
        }

        public static ControllingPlayer PlayerTwo
        {
            get { return new ControllingPlayer(PlayerIndex.Two); }
        }

        public static ControllingPlayer PlayerThree
        {
            get { return new ControllingPlayer(PlayerIndex.Three); }
        }

        public static ControllingPlayer PlayerFour
        {
            get { return new ControllingPlayer(PlayerIndex.Four); }
        }

        public static ControllingPlayer AI
        {
            get
            {
                return new ControllingPlayer();
            }
        }

        PlayerIndex? m_oLocalGamer;
        NetworkGamer m_oRemoteGamer;

    }
}
